package p.ithorns.integration.hazelcast.execute;

import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.HazelcastInstanceAware;

import java.io.Serializable;
import java.util.concurrent.Callable;

/**
 * Echo
 *
 * @author Ht.L
 * @date 2023-11-20 16:07
 * @since 1.0.0
 */
public class Echo implements Callable<String>, Serializable, HazelcastInstanceAware {

    String input = null;

    private transient HazelcastInstance hazelcastInstance;

    public Echo() {
    }

    @Override
    public void setHazelcastInstance( HazelcastInstance hazelcastInstance ) {
        this.hazelcastInstance = hazelcastInstance;
    }

    public Echo(String input) {
        this.input = input;
    }

    @Override
    public String call() {
        return hazelcastInstance.getCluster().getLocalMember().toString() + ":" + input;
    }

}